/**
 * Created by limx on 2016/4/15.
 */
window.onload = function () {
    initSideBar(1);
}

/**
 * 保存供车信息
 */
function save_info() {
    if (checkInfo()) {
        //保存信息
        var id = $("#hidId").val();
        var username = $("#username").val();
        var password = $("#password").val();
        var name = $("#name").val();

        var json = {
            "id": id,
            "username": username,
            "password":password,
            "name":name
        };

        $.post("/Home/Admin/pfnAdd", json, function (jsonData) {
            if (jsonData.STATUS == "1") {
                location = "/Home/Admin/index";
            }
            else {
                showAlert(jsonData.MESSAGE);
            }
        }, "json")
    }
}

function checkInfo() {
    var username = $("#username").val();
    var password = $("#password").val();
    var name = $("#name").val();

    if (username.trim() == "") {
        showAlert("登录名不能为空！");
        return false;
    }
    if (name.trim() == "") {
        showAlert("姓名不能为空！");
        return false;
    }
    return true;
}